Simple git example (remote repository)
In the last example we were working with a purely local repository. This example shows you how to work with remote repositories.
We’re going to convert the local repository we previously created in to a “bare” repository, this is a repository we can easily do “pushes” and “pulls” from (like commits and updates in svn). Once you’ve done this you won’t use this central repository to work on directly, it’ll just be where everything is stored.
0. On your “server”, convert the repository to be a “bare” repository.
cd testproject git config --bool core.bare true
1. On your client “clone” (checkout in svn nomenclature) the repository.
This depends on how you’re accessing the repository but if it’s over ssh you can do this:
git clone ssh://[email protected]/home/myuser/testproject
2. Create a file and push it (commit in svn nomenclature):
touch remotetest git add remotetest git commit remotetest git push
3. Pull the latest version (update in svn nomenclature):
git pull